//package com.sk.bilibili.controller;
//
//import com.sk.bilibili.utils.BSessionUtils;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.util.Enumeration;
//
///**
// * @author 邵康
// * @date 2021/12/23 12:58
// */
////@CrossOrigin
////@RestController
//public class TestController {
//
//    @GetMapping("/getId")
//    public String getId(){
////        return BSessionUtils.getSession().getId();
//    }
//
//    @GetMapping("/test")
//    public String test(HttpServletRequest request,HttpServletResponse response){
////        HttpSession session = BSessionUtils.getSession();
////        Object num = session.getAttribute("num");
////        if(num==null){
////            session.setAttribute("num",0);
////        }else {
////            session.setAttribute("num",((Integer)num)+1);
////        }
////        System.out.println(num);
////        System.out.println(request.getSession().getId());
//////        Cookie[] cookies = request.getCookies();
//////        for (int i = 0; i < cookies.length; i++) {
//////            System.out.println(cookies[i].getName()+":"+cookies[i].getValue());
//////        }
//////        System.out.println(HttpSessionUtils.getSession().toString());
//////        response.addCookie(new Cookie("test","BiliBili"));
//        Enumeration<String> names = request.getHeaderNames();
//        while (names.hasMoreElements()){
//            String key = names.nextElement();
//            System.out.println(key+":"+request.getHeader(key));
//        }
//        response.setHeader("test","BiliBili");
//        return BSessionUtils.getSession().getId();
//    }
//
//
//
//}
